<html>
<head><meta charset="utf-8"><title>Build scripts and environment · t-release · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/index.html">t-release</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html">Build scripts and environment</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="235583796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235583796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> weltling <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235583796">(Apr 21 2021 at 21:16)</a>:</h4>
<p>Hi,</p>
<p>where could i find the build scripts and environment setup used to produce official rustc builds? I was initially looking for how to build rustc for x86_64-pc-windows-gnu host to target aarch64-unknown-linux-gnu. Hope to learn from the production scripts as building locally fails in various ways, as <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/Compiling.20rustc.20for.20MingW.20host.20on.20Linux">https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Compiling.20rustc.20for.20MingW.20host.20on.20Linux</a> doesn't seem to have traction. If there are any other tips, it'd be even better.</p>
<p>Thanks!</p>



<a name="235585365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235585365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235585365">(Apr 21 2021 at 21:28)</a>:</h4>
<p>The builds are driven on GitHub's CI with this file: <a href="https://github.com/rust-lang/rust/blob/master/.github/workflows/ci.yml">https://github.com/rust-lang/rust/blob/master/.github/workflows/ci.yml</a></p>
<p>For <code>x86_64-pc-windows-gnu</code> it uses GitHub Windows image which has a bunch of stuff pre-installed: <a href="https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md">https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md</a></p>
<p>Important for <code>x86_64-pc-windows-gnu</code> is the install-mingw script: <a href="https://github.com/rust-lang/rust/blob/master/src/ci/scripts/install-mingw.sh">https://github.com/rust-lang/rust/blob/master/src/ci/scripts/install-mingw.sh</a></p>
<p>After installing things, it just runs <a href="https://github.com/rust-lang/rust/blob/b849326744a8eec939e592f0ab13bff85cc865d3/.github/workflows/ci.yml#L403-L409">x.py dist</a>.</p>
<p>The <code>aarch64-unknown-linux-gnu</code> target is built via the <a href="https://github.com/rust-lang/rust/blob/master/src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile"><code>dist-aarch64-linux</code> Dockerfile</a>.</p>



<a name="235585720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235585720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235585720">(Apr 21 2021 at 21:31)</a>:</h4>
<p>I should also probably mention that the main configuration is driven by <a href="https://github.com/rust-lang/rust/blob/master/src/ci/run.sh"><code>run.sh</code></a>, which adds a bunch of settings to config.toml.</p>



<a name="235656155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235656155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> weltling <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235656155">(Apr 22 2021 at 10:57)</a>:</h4>
<p>Thanks a golden read, thanks a lot! I probably see why i have the issue now. In short, i use a config similar to the below:</p>
<div class="codehilite"><pre><span></span><code>changelog-seen = 2

[target.aarch64-unknown-linux-gnu]
llvm-config = &quot;/usr/bin/llvm-config-10&quot;

[target.x86_64-pc-windows-gnu]
llvm-config = &quot;/usr/bin/llvm-config-10&quot;

[target.x86_64-unknown-linux-gnu]
llvm-config = &quot;/usr/bin/llvm-config-10&quot;

[rust]
rpath = true
channel = &quot;stable&quot;
optimize = true

[build]
submodules = false
docs = false
vendor = true
target = [&quot;aarch64-unknown-linux-gnu&quot;, &quot;x86_64-pc-windows-gnu&quot;]
host = [&quot;x86_64-pc-windows-gnu&quot;]
build = &quot;x86_64-unknown-linux-gnu&quot;
</code></pre></div>
<p>and then invoke </p>
<p><code>python3 src/bootstrap/bootstrap.py build --stage 2</code>.</p>
<p>We use a similar approach in <a href="https://github.com/meta-rust/meta-rust">https://github.com/meta-rust/meta-rust</a> to produce a cross rustc for the Yocto SDK for Linux host. A similar way it works is when <code>[build]</code> contains</p>
<div class="codehilite"><pre><span></span><code>target = [&quot;aarch64-unknown-linux-gnu&quot;, &quot;x86_64-unknown-linux-gnu&quot;]
host = [&quot;x86_64-unknown-linux-gnu&quot;]
build = &quot;x86_64-unknown-linux-gnu&quot;
</code></pre></div>
<p>In the case AMD64 Linux <code>build == host</code>- <code>rustc</code> is built for host and <code>std</code> is built for both host and target in just one shot. But when I try to have <code>build != host</code> and specifically when host is MingW, it doesn't seem to be going well with cross compiling for MingW. In the scripts you've linked, the MingW part is compiled separately on Windows, and the AARCH64 part is compiled separately, too.</p>
<p>Why I'm striving to do it this way is Yocto specific. There, the MingW based part is cross compiled under Linux and also includes target libraries so then compilers can be pointed to the correct sysroot. It seems that if rustc can't be cross compiled on Linux for MingW, then it can't be integrated in Yocto this way.  Perhaps any advise/comment from your side on the matter described? ATM it seems I need more experiment especially looking how it is done for the official build in separate passes.</p>
<p>Thanks!</p>



<a name="235706655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235706655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235706655">(Apr 22 2021 at 16:23)</a>:</h4>
<p>Sorry, I don't have any experience building mingw on linux.</p>



<a name="235710137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235710137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DPC <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235710137">(Apr 22 2021 at 16:47)</a>:</h4>
<p>i guess <a class="stream" data-stream-id="242791" href="/#narrow/stream/242791-t-infra">#t-infra</a> might be a better place for this (though many members are here )</p>



<a name="235727217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235727217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> weltling <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235727217">(Apr 22 2021 at 18:36)</a>:</h4>
<p><span class="user-mention" data-user-id="120823">@DPC</span>  I was asking on several channels about this, but then thought people that release should know best on the matter :) That's why i landed here. I'll keep t-infra in mind OFC.</p>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span> ack, you already helped a lot. Thanks for the guidance! There are sure any possible quirks just seeing how things done officially is probably the best way to choose.</p>
<p>Thanks</p>



<a name="235727427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235727427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DPC <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235727427">(Apr 22 2021 at 18:38)</a>:</h4>
<p>we are a sub-team of infra, so most likely the people who answer you there would answer you so not an issue <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span> i just feel there's a chance that other non-release infra people might get to you faster than here <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="235727802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235727802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235727802">(Apr 22 2021 at 18:40)</a>:</h4>
<p>uh, release is not a subteam of infra</p>



<a name="235727834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235727834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235727834">(Apr 22 2021 at 18:40)</a>:</h4>
<p>it's a top-level team</p>



<a name="235727846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235727846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235727846">(Apr 22 2021 at 18:40)</a>:</h4>
<p>(essentially)</p>



<a name="235727896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235727896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235727896">(Apr 22 2021 at 18:40)</a>:</h4>
<p>but yeah, <a class="stream" data-stream-id="242791" href="/#narrow/stream/242791-t-infra">#t-infra</a> or here is both fine</p>



<a name="235730156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/241545-t-release/topic/Build%20scripts%20and%20environment/near/235730156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DPC <a href="https://rust-lang.github.io/zulip_archive/stream/241545-t-release/topic/Build.20scripts.20and.20environment.html#235730156">(Apr 22 2021 at 18:57)</a>:</h4>
<p>ah never mind <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>